//
//  CellConfig.swift
//  CooperSwift_Example
//
//  Created by 计海峰 on 2021/5/24.
//  Copyright © 2021 CocoaPods. All rights reserved.
//

import Foundation
import UIKit

protocol TableCellConfigProtocol {
    
    func cellCls() -> UITableViewCell.Type
    
    func bgColor() -> UIColor?
    
    func cellHeight() -> CGFloat?
    
    var model: Any? { get set }
    
    init(_ model: Any)
    
}

extension TableCellConfigProtocol {
    
    func cellCls() -> UITableViewCell.Type {
        return UITableViewCell.self
    }
    
    func bgColor() -> UIColor? {
        return nil
    }

    func cellHeight() -> CGFloat? {
        return nil
    }
    
}

// struct
struct TestCellModel : TableCellConfigProtocol {
    
    var model: Any?
    
    init(_ model: Any) {
      self.model = model
    }
    
    init(_ model: Any, parentKey: String?) {
        self.model = model
    }
    
    func cellCls() -> UITableViewCell.Type {
        return TestAutoCell.self
    }
    
}
